package com.kharthick.pwGame.rules;

import java.util.Iterator;
import java.util.List;
import java.util.Vector;

import com.kharthick.pwGame.players.Player;
import com.kharthick.pwGame.units.Unit;

public class YesNo {
	static Player targetPlayer;
	
	public static boolean inRange(Vector<Integer> pos, int row2, int col2, int limit) {
		int row1 = pos.get(0);
		int col1 = pos.get(1);
		//pass TILE_SIZE later on maybe, can I have a TILE_SIZE variable visible through the whole program?
		
		int d;
		
		d = Math.abs(row1-row2) + Math.abs(col1-col2);
		
		if(limit >= d){
			return true;
		}
		else
			return false;
	}
	
	public static boolean empty(int x, int y, List<Player> players){
		
		for(Iterator it = players.iterator(); it.hasNext();){
			Player p = (Player) it.next();
			/*if(null != p.getUnitByScreenPosition(x, y)){
				System.out.println(p.getUnitByScreenPosition(x, y).isActive());
				System.out.println(p.getUnitByScreenPosition(x, y).getRange());
			}*/
			if(null != p.getUnitByScreenPosition(x, y)){
				
				targetPlayer = p;
				return false;
			}			
		}
		
		return true;
	}
}
